import 'package:acaleph/mvp/presenter/list_presenter.dart';
import 'package:acaleph/mvp/repository/list_repository.dart';
import 'package:acaleph/mvp/repository/list_repository_impl.dart';

class ListPresenterImpl implements ListPresenter {
  TestListView _view;

  ListRepository _repository;
  ListPresenterImpl(this._view) {
    _view.setPresenter(this);
  }

  @override
  loadList(int length) {
    assert(_view != null);
    _repository.loadList(length).then((data) {
      _view.onLoadListSuc(data);
    }).catchError((error) {
      _view.onLoadListFail();
    });
  }

  @override
  init() {
    _repository = new ListRepositoryImpl();
  }
}
